home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
System Booster
/
System Booster.iso
/
Systemmonitors
/
RSys
/
RSysSrc.lha
/
RSysHandlerList.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-09-19
|
4KB
|
141 lines
/*
***************************************************************************
*
* Datei:
* RSysHandlerList.c
*
* Inhalt:
*
* --- Globale Routinen ---
*
* void MakeHandlerList ( void );
*
* --- Lokale Routinen ---
*
*
* Bemerkungen:
* Erzeugung einer Liste von Inputhandlern.
*
* Erstellungsdatum:
* 07-Jul-93 Rolf Böhme
*
* Änderungen:
* 07-Jul-93 Rolf Böhme Erstellung
*
***************************************************************************
*/
#include "RSys.h"
/*
* MakeHandlerList() erzeugt eine Liste aller angemeldeten
* InputHandler im System. Dazu muß ein Dummy-Handler
* installiert werden und über diesen werden die anderen
* InputHandler gefunden. Es existiert keine (!) öffentliche
* Liste mit allen InputHandlern.
*/
void
MakeHandlerList(void)
{
int count = 0,
i = 0;
struct MsgPort *InputDevPort = NULL;
struct IOStdReq *InputRequestBlock = NULL;
struct Interrupt HandlerStuff;
struct Node *LoopNode, *StartNode, *node;
DPOS;
if (InputDevPort = (struct MsgPort *)CreatePort((UBYTE *) "RSys-Check-Port", NULL))
{
if (InputRequestBlock = (struct IOStdReq *)CreateStdIO(InputDevPort))
{
if (!OpenDevice((UBYTE *) "input.device", 0, (struct IORequest *) InputRequestBlock, 0))
{
HandlerStuff.is_Code = NULL;
HandlerStuff.is_Data = NULL;
HandlerStuff.is_Node.ln_Pri = -127;
HandlerStuff.is_Node.ln_Name = "RSys-Check-Handler";
InputRequestBlock->io_Command = IND_ADDHANDLER;
InputRequestBlock->io_Data = (APTR) &HandlerStuff;
DoIO((struct IORequest *) InputRequestBlock);
/*
* Da InputHandler über Interrupts gesteuert werden
* ist hier zum Auslesen ein Disable()/Enable()-
* Paar zu verwenden
*/
Disable();
for (LoopNode = (struct Node *) & (HandlerStuff.is_Node);
LoopNode && LoopNode->ln_Pred;
LoopNode = LoopNode->ln_Pred) ;
StartNode = LoopNode->ln_Succ;
for (node = StartNode; node->ln_Succ; node = node->ln_Succ)
if (node != (struct Node *) & (HandlerStuff.is_Node)) count++;
Enable();
countentries = count;
if(NOT(NoEntries()))
{
Entries = AllocScrollEntries(countentries);
Disable();
for (LoopNode = (struct Node *) & (HandlerStuff.is_Node);
LoopNode && LoopNode->ln_Pred;
LoopNode = LoopNode->ln_Pred) ;
StartNode = LoopNode->ln_Succ;
for (node = StartNode; node->ln_Succ && (i < countentries);
node = node->ln_Succ)
if (node != (struct Node *) & (HandlerStuff.is_Node))
{
savestrcpy(Entries[i].se_obj_id.fullname, node, PARTSIZE, NT_INTERRUPT);
Entries[i].se_obj_id.address = node;
sprintf(Entries[i].se_Entry,
EntryAttr[INPUTHDL].ea_dataformat,
Entries[i].se_obj_id.address,
Entries[i].se_obj_id.fullname,
node->ln_Pri,
(long)((struct Interrupt *) node)->is_Data,
(long)((struct Interrupt *) node)->is_Code);
i++;
}
countentries = i;
Enable();
CreateEntryList(SORT, 9);
}
InputRequestBlock->io_Command = IND_REMHANDLER;
InputRequestBlock->io_Data = (APTR) & HandlerStuff;
DoIO((struct IORequest *) InputRequestBlock);
CloseDevice((struct IORequest *) InputRequestBlock);
}
else ErrorHandle("input.device", DEVICE_ERR, OPEN_FAIL, NO_KILL);
DeleteStdIO(InputRequestBlock);
}
else ErrorHandle("CreateStdIO()", MISC_ERR, CREATE_FAIL, NO_KILL);
DeletePort(InputDevPort);
}
else ErrorHandle("RSys-Check-Port", PORT_ERR, CREATE_FAIL, NO_KILL);
return;
}